function get_image_mime($file) {
    $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
    
    switch ($ext) {
	case 'jpg':
	case 'jpeg':
	    $mime = 'image/jpeg';
	    break;
	case 'png';
	$mime = 'image/png';
            break;
        case 'gif';
	default:
	    $mime = 'image/gif';
	    break;
    }
    return $mime;
}
